﻿using Shop.Collect;
using WeDonekRpc.Client.Attr;
using WeDonekRpc.Client.Interface;

namespace Shop.LocalEvent.SpecTemplate
{
    [LocalEventName("Delete")]
    internal class ClearSpecTemplate : IEventHandler<SpecGroupTemplateEvent>
    {
        private readonly ISpecsTemplateCollect _SpecsTemplate;

        public ClearSpecTemplate (ISpecsTemplateCollect template)
        {
            this._SpecsTemplate = template;
        }

        public void HandleEvent (SpecGroupTemplateEvent data, string eventName)
        {
            this._SpecsTemplate.Clear(data.Template.Id);
        }
    }
}
